<template>
	<el-card>
		<follow-table type="date"></follow-table>
		<!-- 新增 / 修改 -->
		<add-or-update ref="addOrUpdateRef" @refreshDataList="getDataList"></add-or-update>
	</el-card>
</template>

<script setup lang="ts">
import { useCrud } from '@/hooks'
import { reactive, ref } from 'vue'
import AddOrUpdate from './date-add-or-update.vue'
import FollowTable from './follow-table.vue'
import { IHooksOptions } from '@/hooks/interface'

const state: IHooksOptions = reactive({
	dataListUrl: '/followupDetails/page',
	deleteUrl: '/followupDetails/delete',
	queryForm: {
		customerId: '',
		customerName: '',
		followerName: ''
	}
})

const dictDataVisible = ref(false)
const dictDataTitle = ref()
const dictTypeId = ref()

const showDictDataHandle = (row: any) => {
	dictDataVisible.value = true
	dictTypeId.value = row.id
	dictDataTitle.value = '跟进日报 - ' + row.dictType
}

const addOrUpdateRef = ref()
const addOrUpdateHandle = (id?: Number) => {
	console.log('addOrUpdateRef.value', addOrUpdateRef.value)

	addOrUpdateRef.value.init(id)
}

const { getDataList, sizeChangeHandle, selectionChangeHandle, sortChangeHandle, currentChangeHandle, deleteBatchHandle } = useCrud(state)
</script>
